<template>
	<view :class="['empty-container', className]" :style="styleName">
		<view class="empty-img">
			<image :src="path"/>
		</view>
		<view class="empty-title text-gray">
			{{title}}
		<view v-if="needRefresh" @click="refresh" class="fs14 defaultColor d-flex justify-center">点击刷新</view>
		</view>
	</view>
</template>

<script>
	import iconImgPath from  '../common/static/images/empty.png';
	export default{
		props:{
			needRefresh:{
				type: Boolean,
				default: false
			},
			title:{
				type:String,
				default:'您没有相关的记录'
			},
			className: {
				type: String,
				default: ''
			},
			styleName: {
				type: String,
				default: ''
			}
		},
		data(){
			return {
				path:iconImgPath
			}
		},
		methods:{
			refresh(){
				this.$emit('refresh')
			}
		}
	}
</script>

<style>
	.empty-container{
		margin:0 auto;
		text-align: center;
		width: 100%;
		box-sizing: border-box;
		padding: 25% 0;
	}
	.empty-img,.empty-title{
		display: block;
	}
	.empty-img{
		margin:0 auto;
		width: 300upx;
		height: 200upx;
	}
	.empty-img image{
		width: 100%;
		height: 100%;
	}
	.empty-title{
		margin-top: 20upx;
	}
</style>
